---
output: 
  bookdown::pdf_document2:
    toc: false
    citation_package: natbib
    fig_caption: yes
    latex_engine: pdflatex
    template: ~/Dropbox/Harvard/pandoc-default-latex.tex
    keep_tex: true
always_allow_html: true
title: "What is Ideological Capture and How Do We Measure It?: Using Antitrust Reform to Understand Expert-Public Cleavages"
author: 
- name: "Nicholas Short"
  affiliation: "Georgia Institute of Technology"
  email: nshort6@gatech.edu
- name: "Sophie Hill"
  affiliation: "Harvard University"
  email: sophie_hill@g.harvard.edu
- name: "Jacob Brown"
  affiliation: "Boston University"
  email: jbrown@bu.edu
header-includes:
    \usepackage{mathtools}
    \usepackage{natbib}
    \usepackage{pdflscape}
    \usepackage{longtable}
    \usepackage{setspace}
    \usepackage{pdfpages}
    \usepackage{caption}
    \captionsetup[table]{font=large}
    \pagenumbering{gobble}
geometry: margin=1in
fontfamily: mathpazo
fontsize: 12pt
linestretch: 2
bibliography: manuscript.bib
biblio-style: apsr2006.bst
---
\thispagestyle{empty}

\begin{center} Word Count: x,xxx \end{center}

\clearpage
\pagenumbering{arabic} 

\pagebreak

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE)
dir.create("tables", showWarnings = FALSE)

library(tidyverse)
library(kableExtra)
library(estimatr)
library(survey)
library(tigris)
library(cregg)
library(quanteda)
library(quanteda.textplots)

load("datasets.RData")

# Make a design object for distributional_data (from the first pilot)

pilot_3_distr_design <- svydesign(ids = ~1, 
                                  data = distributional_data, 
                                  weights = ~weights)

# Make a public survey data of those who did not take the antitrust lawyer survey, and a lawyer survey data of those who did

public_survey_data <- combined_survey_data %>%
  filter(antitrust_lawyer == "No")

lawyer_survey_data <- combined_survey_data %>%
  filter(antitrust_lawyer == "Yes")

# Make design objects for the combined survey data and the public survey data

combined_survey_design <- svydesign(ids = ~1, data = combined_survey_data, weights = ~weights)
public_survey_design <- svydesign(ids = ~1, data = public_survey_data, weights = ~weights)

# Make a public survey conjoint data set and a lawyer conjoint data set

public_survey_conjoint <- combined_survey_conjoint %>%
  semi_join(public_survey_data, by = "ResponseId") 

lawyer_survey_conjoint <- combined_survey_conjoint %>%
  semi_join(lawyer_survey_data, by = "ResponseId") 

# Make design objects for the public survey conjoint data and the lawyer survey conjoint data (used to make Figure 1)

public_survey_merger_design <- svydesign(ids = ~ResponseId, data = public_survey_conjoint, weights = ~weights)
lawyer_survey_merger_design <- svydesign(ids = ~ResponseId, data = lawyer_survey_conjoint, weights = ~weights)

# Make economic and social effects outcomes binaries for some regressions (see hypotheses 2 and 7)

hypothesis_7_data <- public_survey_data %>%
  mutate(across(.cols = c(econ_entrepreneurship, econ_innovation, econ_lower_prices, econ_higher_quality),
                .fns = ~ case_when(.x %in% c("Agree", "Neither") ~ 0,
                                   .x == "Disagree" ~ 1)),
         across(.cols = c(social_infringe_lib, social_pol_influence, social_local_commun, social_tbtf),
                .fns = ~ case_when(.x %in% c("Disagree", "Neither") ~ 0,
                                   .x == "Agree" ~ 1)),
         enforcement_num = case_when(enforcement == "Challenge more" ~ 1,
                                     enforcement == "Challenge the same" ~ 0,
                                     enforcement == "Challenge less" ~ 0,
                                     TRUE ~ NA_real_))

hypothesis_2_data <- combined_survey_data %>%
  mutate(across(.cols = c(econ_entrepreneurship, econ_innovation, econ_lower_prices, econ_higher_quality),
                .fns = ~ case_when(.x %in% c("Disagree", "Neither") ~ 0,
                                   .x == "Agree" ~ 1)),
         across(.cols = c(social_infringe_lib, social_pol_influence, social_local_commun, social_tbtf),
                .fns = ~ case_when(.x %in% c("Agree", "Neither") ~ 0,
                                   .x == "Disagree" ~ 1)))
```

# Manuscript

\pagebreak

The code below generates Table 1 in the manuscript.

```{r table-1}

combined_survey_conjoint %>%
  select(ResponseId, Lobbying, Employees, Prices, Industry, Quality, Bailout, Layoffs) %>%
  pivot_longer(cols = -ResponseId, names_to = "Attribute", values_to = "Levels") %>%
  group_by(Attribute, Levels) %>%
  summarize(`Num obs.` = n()) %>%
  ungroup() %>%
  select(-Attribute) %>%
  kable(caption = "\\label{attributes} Hypothetical merger attributes") %>%
  kable_styling(font_size = 8) %>%
  pack_rows("Bailout risk",1,3) %>%
  pack_rows("Firm size",4,6) %>%
  pack_rows("Industry",7,12) %>%
  pack_rows("Layoffs",13,17) %>%
  pack_rows("Political influence",18,20) %>%
  pack_rows("Prices",21,25) %>%
  pack_rows("Quality",26,28) %>%
  footnote(general = "This table shows each attribute included in the conjoint experiment, the levels of each attribute, and the number of observations for each level.", threeparttable = TRUE)
```

\pagebreak


The code below generates Figure 1 in the manuscript.

```{r figure-1}

merger_conjoint_formula <- answer_binary_num ~ Lobbying + Employees + Layoffs + Prices + Industry + Quality + Bailout

merger_conjoint_amce <- amce(data = public_survey_merger_design, formula = merger_conjoint_formula, id = ~ResponseId, weights = ~weights)
lawyer_merger_conjoint_amce <- amce(data = lawyer_survey_merger_design, formula = merger_conjoint_formula, id = ~ResponseId, weights = ~weights)

merger_conjoint_amce %>% 
  mutate(feature = as.character(feature)) %>%
  filter(!feature %in% c("Industry","Employees")) %>%
  mutate(feature = case_when(feature == "Layoffs" ~ "Employment",
                             feature == "Bailout" ~ "Bailout risk",
                             TRUE ~ feature),
         feature = factor(feature, levels = c("Prices", "Quality", "Bailout risk", "Employment", "Lobbying"))) %>%
  ggplot(aes(x = estimate, y = level, xmin = lower, xmax = upper)) + 
  geom_point() + 
  facet_wrap(~feature, scales = "free_y", nrow = 3, ncol = 2) +
  geom_errorbar(width = 0.2) + 
  theme_minimal() + 
  theme(legend.position = "bottom") + 
  labs(x = NULL, y = NULL) + 
  geom_vline(xintercept = 0, linetype = "dotted")
```

\pagebreak


The code below generates Figure 2 in the manuscript.

```{r figure-2}

policy_means <- svyby(~consumer_welfare + enforcement, by = ~party, design = public_survey_design, FUN = svymean, na.rm = TRUE) %>%
  as_tibble() %>%
  pivot_longer(cols = -party) %>%
  mutate(variable = case_when(str_detect(name, "consumer_welfare") ~ "Keep cons. welfare standard?",
                              str_detect(name, "enforcement") ~ "Stronger enforcement?",
                              TRUE ~ NA_character_),
         estimate = case_when(str_sub(name, start = 1, end = 3) == "se." ~ "SE",
                             TRUE ~ "mean"),
         position = case_when(str_detect(name, "Equal weight") ~ "No",
                              str_detect(name, "Mainly consumers") ~ "Yes",
                              str_detect(name, "Challenge more") ~ "Challenge more",
                              str_detect(name, "Challenge the same") ~ "No change",
                              str_detect(name, "Challenge fewer") ~ "Challenge less",
                              TRUE ~ NA_character_)
         ) %>%
  select(-name) %>%
  arrange(party, variable, position, estimate, value) %>%
  pivot_wider(names_from = "estimate", values_from = "value") %>%
  arrange(variable, position, party)

policy_means %>%
  filter(position %in% c("No", "Challenge more")) %>%
  mutate(
    position = case_when(
      position == "No" ~ "Replace the CW standard",
      position == "Challenge more" ~ "Challenge more mergers"
    ),
  ) %>%
  select(-variable) %>%
  ggplot(aes(
    x = mean, y = position,
    xmin = mean - 1.386*SE, xmax = mean + 1.386*SE,
    fill = party
  )) +
  geom_bar(
    width = 0.5, stat = "identity",
    position = position_dodge(width = 0.6),
    color = "black", linewidth = 0.2
  ) +
  geom_errorbar(
    width = 0.12, linewidth = 0.4,
    position = position_dodge(width = 0.6),
    color = "black"
  ) +
  theme_minimal() + 
  labs(x = NULL, y = NULL, fill = NULL) + 
  theme(legend.position = "bottom") + 
  scale_fill_manual(values = c("grey30","grey60","grey85")) + 
  guides(fill = guide_legend(reverse = TRUE))
```

\pagebreak


The code below generates Figure 3 in the manuscript.

```{r figure-3}

lawyer_comparison <- svyby(~consumer_welfare_num + enforcement_num, by = ~party, design = public_survey_design, FUN = svymean, na.rm = TRUE) %>%
  as_tibble() %>%
  pivot_longer(cols = -party) %>%
  rename(level = party) %>%
  mutate(iv = "Partisanship") %>%
  bind_rows(svyby(~consumer_welfare_num + enforcement_num, by = ~antitrust_lawyer, design = combined_survey_design, FUN = svymean, na.rm = TRUE) %>%
  as_tibble() %>%
  pivot_longer(cols = -antitrust_lawyer) %>%
    rename(level = antitrust_lawyer) %>%
  mutate(iv = "Expertise")) %>%
  filter(level != "Independent") %>% # Drop Independents
  mutate(level = as.character(level),
         estimate = case_when(str_sub(name, start = 1, end = 3) == "se." ~ "SE",
                             TRUE ~ "mean"),
         level = case_when(level == "No" ~ "Public",
                           level == "Yes" ~ "Antitrust lawyer",
                           TRUE ~ level),
         level = factor(level, levels = c("Antitrust lawyer", "Public", "Republican", "Democrat")),
         dv = case_when(str_detect(name, "consumer_welfare_num") ~ "Replace CW standard",
                        str_detect(name, "enforcement_num") ~ "Challenge more mergers",
                        TRUE ~ NA_character_)
         ) %>%
  select(-name) %>%
  arrange(iv, level, estimate, value) %>%
  pivot_wider(names_from = "estimate", values_from = "value")

lawyer_comparison %>%
  filter(dv == "Replace CW standard") %>%
  mutate(
    iv = factor(iv, levels = c("Partisanship","Expertise"))
  ) %>%
  ggplot(aes(
    x = mean, y = level,
    xmin = mean - 1.386*SE, xmax = mean + 1.386*SE,
    fill = iv
  )) +
  geom_bar(
    width = 0.5, stat = "identity",
    position = position_dodge(width = 0.6),
    color = "black", linewidth = 0.2
  ) +
  geom_errorbar(
    width = 0.12, linewidth = 0.4,
    position = position_dodge(width = 0.6),
    color = "black"
  ) +
  theme_minimal() + 
  labs(x = NULL, y = NULL, fill = NULL) + 
  theme(legend.position = "bottom") + 
  scale_fill_manual(values = c("Partisanship" = "grey30",
                               "Expertise"     = "grey80"))
```

\pagebreak


The code below generates Figure 4 in the manuscript.

```{r figure-4}

svymean(~econ_entrepreneurship + econ_innovation + econ_lower_prices + econ_higher_quality, design = public_survey_design, na.rm = TRUE) %>%
  as_tibble(rownames = "variable_level") %>%
  mutate(variable = case_when(str_detect(variable_level, "econ_entrepreneurship") ~ "Increases entrepreneurship",
                              str_detect(variable_level, "econ_higher_quality") ~ "Increases product/service quality",
                              str_detect(variable_level, "econ_lower_prices") ~ "Lowers prices",
                              str_detect(variable_level, "econ_innovation") ~ "Increases innovation",
                              TRUE ~ NA_character_),
         position = case_when(str_detect(variable_level, "Disagree") ~ "Disagree",
                              str_detect(variable_level, "Neither") ~ "Neither agree nor disagree",
                              str_detect(variable_level, "Agree") ~ "Agree",
                              TRUE ~ NA_character_),
         position = factor(position, levels = c("Disagree", "Neither agree nor disagree", "Agree"))
         ) %>%
  ggplot(aes(x = mean, y = position, xmin = mean - 1.386*SE, xmax = mean + 1.386*SE)) + 
  geom_bar(width = 0.5, stat = "identity") + 
  geom_errorbar(width = 0.1) + 
  facet_wrap(~variable) + 
  theme_minimal() + 
  labs(x = NULL, y = NULL) + 
  xlim(0, 0.6)
```

\pagebreak

The code below generates Figure 5 in the manuscript.

```{r figure-5}

svymean(~social_infringe_lib + social_pol_influence + social_local_commun + social_tbtf, design = public_survey_design, na.rm = TRUE) %>%
  as_tibble(rownames = "variable_level") %>%
  mutate(variable = case_when(str_detect(variable_level, "social_infringe_lib") ~ "Increases power to infringe liberties",
                              str_detect(variable_level, "social_pol_influence") ~ "Increases corp. influence on gov.",
                              str_detect(variable_level, "social_local_commun") ~ "Weaken ties to local communities",
                              str_detect(variable_level, "social_tbtf") ~ "Creates companies too big to fail",
                              TRUE ~ NA_character_),
         variable = factor(variable, levels = c("Weaken ties to local communities", "Increases power to infringe liberties",
                                                "Creates companies too big to fail", "Increases corp. influence on gov.")),
         position = case_when(str_detect(variable_level, "Disagree") ~ "Disagree",
                              str_detect(variable_level, "Neither") ~ "Neither agree nor disagree",
                              str_detect(variable_level, "Agree") ~ "Agree",
                              TRUE ~ NA_character_),
         position = factor(position, levels = c("Disagree", "Neither agree nor disagree", "Agree"))
         ) %>%
  ggplot(aes(x = mean, y = position, xmin = mean - 1.386*SE, xmax = mean + 1.386*SE)) + 
  geom_bar(width = 0.5, stat = "identity") + 
  geom_errorbar(width = 0.1) +
  facet_wrap(~variable) + 
  theme_minimal() + 
  labs(x = NULL, y = NULL) +
  xlim(0, 0.8)
```

\pagebreak


The code below generates Figure 6 in the manuscript.

```{r figure-6}

# Run regressions

hyp_2_lm_entre <- lm_robust(econ_entrepreneurship ~ antitrust_lawyer, data = hypothesis_2_data, se_type = "stata", weights = weights) %>%
  tidy() 

hyp_2_lm_innov <-lm_robust(econ_innovation ~ antitrust_lawyer, data = hypothesis_2_data, se_type = "stata", weights = weights) %>%
  tidy() 

hyp_2_lm_prices <- lm_robust(econ_lower_prices ~ antitrust_lawyer, data = hypothesis_2_data, se_type = "stata", weights = weights) %>%
  tidy() 

hyp_2_lm_quality <-lm_robust(econ_higher_quality ~ antitrust_lawyer, data = hypothesis_2_data, se_type = "stata", weights = weights) %>%
  tidy() 

hyp_2_lm_liberty <- lm_robust(social_infringe_lib ~ antitrust_lawyer, data = hypothesis_2_data, se_type = "stata", weights = weights) %>%
  tidy() 

hyp_2_lm_lobbying <- lm_robust(social_pol_influence ~ antitrust_lawyer, data = hypothesis_2_data, se_type = "stata", weights = weights) %>%
  tidy() 

hyp_2_lm_localties <- lm_robust(social_local_commun ~ antitrust_lawyer, data = hypothesis_2_data, se_type = "stata", weights = weights) %>%
  tidy() 

hyp_2_lm_tbtf <- lm_robust(social_tbtf ~ antitrust_lawyer, data = hypothesis_2_data, se_type = "stata", weights = weights) %>%
  tidy() 

# Bind results together, plot coefficient on antitrust_lawyer variable

risk_comparison <- hyp_2_lm_entre %>%
  bind_rows(hyp_2_lm_innov, hyp_2_lm_prices, hyp_2_lm_quality, hyp_2_lm_liberty, hyp_2_lm_lobbying, hyp_2_lm_localties, hyp_2_lm_tbtf) 

risk_comparison %>%
  filter(term == "antitrust_lawyerYes") %>%
  mutate(risk = case_when(str_detect(outcome,"econ_") ~ "Economic",
                          str_detect(outcome,"social_") ~ "Social",
                          TRUE ~ NA_character_),
         risk = factor(risk, levels = c("Economic", "Social")),
         variable = case_when(str_detect(outcome, "econ_entrepreneurship") ~ "Increases entrepreneurship",
                              str_detect(outcome, "econ_higher_quality") ~ "Increases product/service quality",
                              str_detect(outcome, "econ_lower_prices") ~ "Lowers prices",
                              str_detect(outcome, "econ_innovation") ~ "Increases innovation",
                              str_detect(outcome, "social_infringe_lib") ~ "Increases power to infringe liberties",
                              str_detect(outcome, "social_pol_influence") ~ "Increases corp. influence on gov.",
                              str_detect(outcome, "social_local_commun") ~ "Weaken ties to local communities",
                              str_detect(outcome, "social_tbtf") ~ "Creates companies too big to fail",
                              TRUE ~ NA_character_)) %>%
  ggplot(aes(x = estimate, y = variable, xmin = conf.low, xmax = conf.high, color = risk)) + 
  # geom_bar(width = 0.5, stat = "identity", position = "dodge") + #position = "dodge",  
  geom_point() + 
  geom_errorbar(width = 0.1) +
  facet_wrap(~risk, scales = "free_y", ncol = 1) + 
  theme_minimal() + 
  labs(x = NULL, y = NULL, color = NULL) + 
  theme(legend.position = "bottom") +
  geom_vline(xintercept = 0, linetype = "dashed") + 
  scale_color_manual(values = c("Economic" = "black", "Social" = "grey65"))
```

\pagebreak






\pagebreak

\setcounter{table}{0}
\setcounter{figure}{0}
\setcounter{section}{0}
\setcounter{page}{0}
\renewcommand{\thetable}{A.\arabic{table}}
\renewcommand{\thefigure}{A.\arabic{figure}}
\renewcommand{\thesection}{\Alph{section}}

# Appendix


The code below generates Figure A.1 in the appendix.

```{r distributional-concerns-fig}

svymean(~distr_management + distr_professionals + distr_stockholders + distr_employees, design = pilot_3_distr_design, na.rm = TRUE) %>%
  as_tibble(rownames = "variable_level") %>%
  mutate(variable = case_when(str_detect(variable_level, "distr_management") ~ "Top management",
                              str_detect(variable_level, "distr_professionals") ~ "Lawyers and bankers",
                              str_detect(variable_level, "distr_stockholders") ~ "Stockholders",
                              str_detect(variable_level, "distr_employees") ~ "Employees",
                              TRUE ~ NA_character_),
         position = case_when(str_detect(variable_level, "Help") ~ "Help",
                              str_detect(variable_level, "Neither") ~ "Neither",
                              str_detect(variable_level, "Hurt") ~ "Hurt",
                              str_detect(variable_level, "Don't know") ~ "Don't know",
                              TRUE ~ NA_character_)
         ) %>%
  ggplot(aes(x = mean, y = position, xmin = mean - 1.386*SE, xmax = mean + 1.386*SE)) + 
  geom_col() + 
  facet_wrap(~variable) + 
  theme_minimal() + 
  labs(x = NULL, y = NULL) + 
  geom_errorbar(width = 0.1)
```

\pagebreak

The code below generates Figure A.2 in the appendix.

```{r consitency-fig}

consistency_data %>%
  pivot_wider(id_cols = c(id, variable), values_from = response, names_from = survey, names_prefix = "survey_") %>%
  filter(!is.na(survey_2), !is.na(survey_3)) %>%
  group_by(variable, survey_2, survey_3) %>%
  summarize(n = n()) %>%
  ungroup() %>%
  group_by(variable) %>%
  mutate(share = n / sum(n)) %>%
  mutate(across(.cols = c(survey_2, survey_3), .fns = as.character),
         response_pattern = case_when(survey_2 == survey_3 ~ survey_2,
                                      TRUE ~ paste0("-> ", survey_3))) %>%
  ungroup() %>%
  mutate(variable = case_when(variable == "business_power" ~ "Business power",
                              variable == "government_capture" ~ "Gov. capture",
                              variable == "enforcement" ~ "Enforcement",
                              variable == "consumer_welfare" ~ "Support for CWS",
                              TRUE ~ NA_character_),
    variable = factor(variable, levels = c("Business power", "Gov. capture", "Support for CWS", "Enforcement"))) %>%
  ggplot(aes(x = share, y = response_pattern)) + geom_col() + facet_wrap(~variable, scales = "free_y") + theme_minimal() + labs(x = NULL, y = NULL)
```

\pagebreak

In Appendix D, we discuss issue importance in our first pilot study. Those estimates are generated below.

```{r pilot-1-importance}

importance_data %>% 
  group_by(party, importance) %>%
  summarize(n = n()) %>%
  ungroup() %>%
  group_by(party) %>%
  mutate(share = round(100 * n / sum(n), digits = 2)) %>%
  ungroup() %>%
  kable()
```

\pagebreak

The code in each section below generates a latex table using stargazer. The .tex files are stored in the `/tables` folder and are displayed at the end of the document.

The code below generates Table A.1 in the appendix.

```{r risk-comparison-tab, include = FALSE}

hyp_2_lm_entre <- lm(econ_entrepreneurship ~ antitrust_lawyer + party + age + gender + education + race, data = hypothesis_2_data, weights = weights) 
hyp_2_se_entre <- sqrt(diag(sandwich::vcovHC(hyp_2_lm_entre, type = "HC1")))

hyp_2_lm_innov <-lm(econ_innovation ~ antitrust_lawyer + party + age + gender + education + race, data = hypothesis_2_data, weights = weights) 
hyp_2_se_innov <- sqrt(diag(sandwich::vcovHC(hyp_2_lm_innov, type = "HC1")))

hyp_2_lm_prices <- lm(econ_lower_prices ~ antitrust_lawyer + party + age + gender + education + race, data = hypothesis_2_data, weights = weights) 
hyp_2_se_prices <- sqrt(diag(sandwich::vcovHC(hyp_2_lm_prices, type = "HC1")))

hyp_2_lm_quality <-lm(econ_higher_quality ~ antitrust_lawyer + party + age + gender + education + race, data = hypothesis_2_data, weights = weights) 
hyp_2_se_quality <- sqrt(diag(sandwich::vcovHC(hyp_2_lm_quality, type = "HC1")))

hyp_2_lm_liberty <- lm(social_infringe_lib ~ antitrust_lawyer + party + age + gender + education + race, data = hypothesis_2_data, weights = weights) 
hyp_2_se_liberty <- sqrt(diag(sandwich::vcovHC(hyp_2_lm_liberty, type = "HC1")))

hyp_2_lm_lobbying <- lm(social_pol_influence ~ antitrust_lawyer + party + age + gender + education + race, data = hypothesis_2_data, weights = weights) 
hyp_2_se_lobbying <- sqrt(diag(sandwich::vcovHC(hyp_2_lm_lobbying, type = "HC1")))

hyp_2_lm_localties <- lm(social_local_commun ~ antitrust_lawyer + party + age + gender + education + race, data = hypothesis_2_data, weights = weights) 
hyp_2_se_localties <- sqrt(diag(sandwich::vcovHC(hyp_2_lm_localties, type = "HC1")))

hyp_2_lm_tbtf <- lm(social_tbtf ~ antitrust_lawyer + party + age + gender + education + race, data = hypothesis_2_data, weights = weights) 
hyp_2_se_tbtf <- sqrt(diag(sandwich::vcovHC(hyp_2_lm_tbtf, type = "HC1")))

hyp_2_lm <- list(hyp_2_lm_entre,
                 hyp_2_lm_innov,
                 hyp_2_lm_prices,
                 hyp_2_lm_quality,
                 hyp_2_lm_liberty,
                 hyp_2_lm_lobbying,
                 hyp_2_lm_localties,
                 hyp_2_lm_tbtf
                 )

hyp_2_se <- list(hyp_2_se_entre,
                 hyp_2_se_innov,
                 hyp_2_se_prices,
                 hyp_2_se_quality,
                 hyp_2_se_liberty,
                 hyp_2_se_lobbying,
                 hyp_2_se_localties,
                 hyp_2_se_tbtf
                 )

hyp_2_labels <- c("Antitrust lawyer",
                     "Party: Independent", "Party: Republican",
                     "Age: 40-59", "Age: 60+",
                     "Gender: Female", "Gender: Other",
                     "Educ: Some college", "Educ: Bachelor's degree", "Educ: Graduate degree",
                     "Race: Black", "Race: Latinx", "Race: Asian", "Race: Multiple / Other", 
                     "Constant")

stargazer::stargazer(hyp_2_lm,
                     se = hyp_2_se,
                     dep.var.caption = "",
                     dep.var.labels = c("Entrepren.", "Innovation", "Prices", "Quality", "Infring lib.", "Pol. influence", "Weaken ties", "Too big to fail"),
                     covariate.labels = hyp_2_labels,
                     star.cutoffs = c(0.05, 0.01, 0.001),
                     no.space = TRUE,
                     df = FALSE,
                     header = FALSE,
                     omit.stat = c("f"),
                     font.size = "scriptsize",
                     label = "risk-comparison-tab",
                     out = "tables/risk-comparison-tab.tex"
                     )
```

The code below generates Table A.2 in the appendix.

```{r policy-cleaveage-tab, include = FALSE}

cw_cleavage_lm <- lm(consumer_welfare_num ~ antitrust_lawyer + party + race + gender + age + education,
                     data = combined_survey_data, 
                     weights = weights)

cw_cleavage_se <- sqrt(diag(sandwich::vcovHC(cw_cleavage_lm, type = "HC1")))

enforcement_cleavage_lm <- lm(enforcement_num ~ antitrust_lawyer + party + race + gender + age + education,
                     data = combined_survey_data, 
                     weights = weights)

enforcement_cleavage_se <- sqrt(diag(sandwich::vcovHC(enforcement_cleavage_lm, type = "HC1")))

cleavage_labels <- c("Antitrust lawyer",
                     "Party: Independent", "Party: Republican",
                     "Race: Black", "Race: Latinx", "Race: Asian", "Race: Multiple / Other", 
                     "Gender: Female", "Gender: Other",
                     "Age: 40-59", "Age: 60+",
                     "Educ: Some college", "Educ: Bachelor's degree", "Educ: Graduate degree",
                     "Constant")

stargazer::stargazer(list(cw_cleavage_lm, enforcement_cleavage_lm),
                     se = list(cw_cleavage_se, enforcement_cleavage_se),
                     dep.var.caption = "",
                     dep.var.labels = c("Support for replacing the CW standard", "Support for challenging more mergers"),
                     covariate.labels = cleavage_labels,
                     star.cutoffs = c(0.05, 0.01, 0.001),
                     no.space = TRUE,
                     df = FALSE,
                     header = FALSE,
                     omit.stat = c("f"),
                     font.size = "scriptsize",
                     label = "cw-cleavage-tab",
                     out = "tables/policy-cleavage-tab.tex"
                     )
```

The code below generates Table A.3 in the appendix.

```{r value-basis-tab, include = FALSE}

power_lm <- lm(business_power ~ antitrust_lawyer + party + race + gender + age + education, 
               data = combined_survey_data %>% mutate(business_power = ifelse(business_power == "Too much power and influence", 1, 0)), 
               weights = weights)
power_se <- sqrt(diag(sandwich::vcovHC(power_lm, type = "HC1")))

capture_lm <- lm(government_capture ~ antitrust_lawyer+ party + race + gender + age + education, 
                 data = combined_survey_data %>% mutate(government_capture = ifelse(government_capture == "A few big interests", 1, 0)), 
                 weights = weights)

capture_se <- sqrt(diag(sandwich::vcovHC(capture_lm, type = "HC1")))

busreg_lm <- lm(business_regulation ~ antitrust_lawyer + party + race + gender + age + education, 
                data = combined_survey_data %>% mutate(business_regulation = ifelse(business_regulation == "Necessary to protect public", 1, 0)), 
                weights = weights)
busreg_se <- sqrt(diag(sandwich::vcovHC(busreg_lm, type = "HC1")))

values_labels <- c("Antitrust lawyer",
                   "Party: Independent", "Party: Republican",
                   "Race: Black", "Race: Latinx", "Race: Asian", "Race: Multiple / Other", 
                   "Gender: Female", "Gender: Other",
                   "Age: 40-59", "Age: 60+",
                   "Educ: Some college", "Educ: Bachelor's degree", "Educ: Graduate degree",
                   "Constant")

stargazer::stargazer(list(power_lm, capture_lm, busreg_lm),
                     se = list(power_se, capture_se, busreg_se),
                     dep.var.caption = "",
                     dep.var.labels = c("Too much power in economy", "Gov. works for a few big interests", "Bus. regulation in public interest"),
                     covariate.labels = values_labels,
                     star.cutoffs = c(0.05, 0.01, 0.001),
                     no.space = TRUE,
                     df = FALSE,
                     header = FALSE,
                     omit.stat = c("f"),
                     font.size = "scriptsize",
                     label = "value-basis-tab",
                     out = "tables/value-basis-tab.tex"
                     )
```

The code below generates Table A.4 in the appendix.

```{r public-conjoint-tab, include = FALSE}

# There 2,092 unique ResponseIds with some data on persuasiveness (used to specify degrees of freedom for clustering below)

# public_survey_conjoint %>% select(ResponseId) %>% n_distinct()

merger_conjoint_binary_lm <- lm(formula = answer_binary_num ~ Lobbying + Employees + Layoffs + Prices + Industry + Quality + Bailout, 
                         data = public_survey_conjoint, 
                         weights = weights) 
merger_conjoint_binary_se <- lmtest::coeftest(merger_conjoint_binary_lm, 
                                       vcov = sandwich::vcovCL, # clustered
                                       type = "HC1", # robust
                                       df = 2091,
                                       cluster = ~ResponseId)[,2]
# Repeat with four-point scale

merger_conjoint_fourpoint_lm <- lm(formula = answer_num ~ Lobbying + Employees + Layoffs + Prices + Industry + Quality + Bailout, 
                         data = public_survey_conjoint, 
                         weights = weights) 
merger_conjoint_fourpoint_se <- lmtest::coeftest(merger_conjoint_fourpoint_lm, 
                                       vcov = sandwich::vcovCL, # clustered
                                       type = "HC1", # robust
                                       df = 2091,
                                       cluster = ~ResponseId)[,2]

merger_conjoint_labels <- c("Lobbying: less", "Lobbying: more",
                            "Size: 25,000", "Size: 100,000",
                            "Employment: 20\\% decrease", "Employment: 10\\% decrease", "Employment: 5\\% decrease", "Employment: 5\\% increase", 
                            "Prices: 20\\% lower", "Prices: 10\\% lower", "Prices: 5\\% lower", "Prices: 5\\% higher", 
                            "Industry: Gas \\& Oil", "Industry: Grocery store chain", "Industry: Hospital", "Industry: Pharmaceutical", "Industry: Telecom",
                            "Quality: worse", "Quality: better",
                            "Bailout: less likely", "Bailout: more likley")

stargazer::stargazer(list(merger_conjoint_binary_lm, merger_conjoint_fourpoint_lm),
                     se = list(merger_conjoint_binary_se, merger_conjoint_fourpoint_se),
                     dep.var.caption = "",
                     dep.var.labels = c("Challenge merger (binary)", "Challenge merger (four-point scale)"),
                     covariate.labels = merger_conjoint_labels,
                     star.cutoffs = c(0.05, 0.01, 0.001),
                     no.space = TRUE,
                     df = FALSE,
                     header = FALSE,
                     omit.stat = c("f"),
                     font.size = "scriptsize",
                     label = "public-conjoint-tab",
                     out = "tables/public-conjoint-tab.tex"
                     )
```

The code below generates Table A.5 in the appendix.

```{r conjoint-profile-diffs, include = FALSE}

# public_survey_conjoint %>% filter(party != "Independent") %>% select(ResponseId) %>% n_distinct()

partisan_conjoint_diffs_lm <- lm(formula = answer_binary_num ~ party * (Lobbying + Employees + Layoffs + Prices + Industry + Quality + Bailout), 
                         data = public_survey_conjoint %>% filter(party != "Independent"), 
                         weights = weights) 

partisan_conjoint_diffs_lm %>% summary()

partisan_conjoint_diffs_se <- lmtest::coeftest(partisan_conjoint_diffs_lm, 
                                               vcov = sandwich::vcovCL, # clustered
                                               type = "HC1", # robust
                                               df = 1530,
                                               cluster = ~ResponseId)[,2]

# combined_survey_conjoint %>% select(ResponseId) %>% n_distinct()

lawyer_conjoint_diffs_lm <- lm(formula = answer_binary_num ~ antitrust_lawyer * (Lobbying + Employees + Layoffs + Prices + Industry + Quality + Bailout), 
                               data = combined_survey_conjoint, 
                               weights = weights) 

lawyer_conjoint_diffs_lm %>% summary()

laywer_conjoint_diffs_se <- lmtest::coeftest(lawyer_conjoint_diffs_lm, 
                                             vcov = sandwich::vcovCL, # clustered
                                             type = "HC1", # robust
                                             df = 2194,
                                             cluster = ~ResponseId)[,2]

stargazer::stargazer(list(partisan_conjoint_diffs_lm, lawyer_conjoint_diffs_lm),
                     se = list(partisan_conjoint_diffs_se, laywer_conjoint_diffs_se),
                     float = FALSE, 
                     dep.var.caption = "",
                     dep.var.labels = "Challenge merger (binary)",
                     star.cutoffs = c(0.05, 0.01, 0.001),
                     no.space = TRUE,
                     df = FALSE,
                     header = FALSE,
                     omit.stat = c("f"),
                     font.size = "scriptsize",
                     label = "conjoint-diffs-tab",
                     out = "tables/conjoint-diffs-tab-temp.tex",
                     notes = "Main effects and insignificant interactions ommitted"
                     )

# The table is too long for one page, so I manually convert it to a longtable to display correctly upon knitting

out <- "tables/conjoint-diffs-tab.tex"

# Convert to longtable
temp_file_read <- readLines("tables/conjoint-diffs-tab-temp.tex")
temp_file_read <- sub("\\\\begin\\{tabular\\}", "\\\\begin{longtable}", temp_file_read)
temp_file_read <- sub("\\\\end\\{tabular\\}",   "\\\\end{longtable}",   temp_file_read)

i <- which(grepl("^\\\\begin\\{longtable\\}", temp_file_read))[1]
ins <- c("\\caption{}\\\\",
         "\\label{conjoint-diffs-tab}\\\\")
temp_file_read <- append(temp_file_read, ins, after = i)

writeLines(temp_file_read, "tables/conjoint-diffs-tab.tex")
```


The code below generates Table A.6 in the appendix.

```{r candidate-evaluation-tab, include = FALSE}

# Limit data to Democrats and Republicans

candidate_choice_data_binary <- candidate_choice_data %>% 
  filter(resp_party != "Independent") %>% 
  mutate(resp_party = factor(resp_party, levels = c("Democrat","Republican")))

# If grouping Democrats with Independents filter on resp_party_2 == "Democrat or Independent" (not resp_party == "Democrat") and use df = 309
# Evaluate the impact of issue agreement, copartisanship, and candidate experience on Democratic respondent evaluations

candidate_conjoint_amce_dem_lm <- lm(formula = answer ~ copartisan + cand_experience + agree_fossil_fuels + agree_break_up + agree_min_wage + agree_photo_id, 
                                     data = candidate_choice_data_binary %>% filter(resp_party == "Democrat")) 
candidate_conjoint_amce_dem_se <- lmtest::coeftest(candidate_conjoint_amce_dem_lm, 
                                       vcov = sandwich::vcovCL, # clustered
                                       type = "HC1", # robust
                                       df = 117, # 118 Democratic respondents in the sub-sample
                                       cluster = ~id)[,2]

# Evaluate the impact of issue agreement, copartisanship, and candidate experience on Republican respondent evaluations

candidate_conjoint_amce_rep_lm <- lm(formula = answer ~ copartisan + cand_experience + agree_fossil_fuels + agree_break_up + agree_min_wage + agree_photo_id, 
                                     data = candidate_choice_data_binary %>% filter(resp_party == "Republican")) 
candidate_conjoint_amce_rep_se <- lmtest::coeftest(candidate_conjoint_amce_rep_lm, 
                                       vcov = sandwich::vcovCL, # clustered
                                       type = "HC1", # robust
                                       df = 126, # 127 Republican respondents in the sub-sample
                                       cluster = ~id)[,2]

candidate_conjoint_labels <- c("Co-partisan: no", 
                            "Cand. experience: 4 years", "Cand. experience: 8 years", "Cand. experience: 12 years", 
                            "Boost fossil fuels: don't agree",
                            "Break up companies: don't agree",
                            "Raise min. wage: don't agree",
                            "Require photo ID: don't agree",
                            "Constant")

stargazer::stargazer(list(candidate_conjoint_amce_dem_lm, candidate_conjoint_amce_rep_lm),
                     se = list(candidate_conjoint_amce_dem_se, candidate_conjoint_amce_rep_se),
                     dep.var.labels = "Vote for candidate",
                     covariate.labels = candidate_conjoint_labels,
                     star.cutoffs = c(0.05, 0.01, 0.001),
                     no.space = TRUE,
                     df = FALSE,
                     header = FALSE,
                     omit.stat = c("f"),
                     font.size = "scriptsize",
                     label = "candidate-evaluation-tab",
                     out = "tables/candidate-evaluation-tab.tex"
                     )
```

The code below generates Table A.7 in the appendix.

```{r cws-preference-basis-tab, include = FALSE}

entrepreneurship_lm <- lm(consumer_welfare_num ~ econ_entrepreneurship + party + age + gender + education + race + income, data = hypothesis_7_data, weights = weights) 
entrepreneurship_se <- sqrt(diag(sandwich::vcovHC(entrepreneurship_lm, type = "HC1")))

innovation_lm <- lm(consumer_welfare_num ~ econ_innovation + party + age + gender + education + race + income, data = hypothesis_7_data, weights = weights) 
innovation_se <- sqrt(diag(sandwich::vcovHC(innovation_lm, type = "HC1")))

prices_lm <- lm(consumer_welfare_num ~ econ_lower_prices + party + age + gender + education + race + income, data = hypothesis_7_data, weights = weights) 
prices_se <- sqrt(diag(sandwich::vcovHC(prices_lm, type = "HC1")))

quality_lm <- lm(consumer_welfare_num ~ econ_higher_quality + party + age + gender + education + race + income, data = hypothesis_7_data, weights = weights) 
quality_se <- sqrt(diag(sandwich::vcovHC(quality_lm, type = "HC1")))

liberties_lm <- lm(consumer_welfare_num ~ social_infringe_lib + party + age + gender + education + race + income, data = hypothesis_7_data, weights = weights) 
liberties_se <- sqrt(diag(sandwich::vcovHC(liberties_lm, type = "HC1")))

influence_lm <- lm(consumer_welfare_num ~ social_pol_influence + party + age + gender + education + race + income, data = hypothesis_7_data, weights = weights) 
influence_se <- sqrt(diag(sandwich::vcovHC(influence_lm, type = "HC1")))

localties_lm <- lm(consumer_welfare_num ~ social_local_commun + party + age + gender + education + race + income, data = hypothesis_7_data, weights = weights) 
localties_se <- sqrt(diag(sandwich::vcovHC(localties_lm, type = "HC1")))

tbtf_lm <- lm(consumer_welfare_num ~ social_tbtf + party + age + gender + education + race + income, data = hypothesis_7_data, weights = weights) 
tbtf_se <- sqrt(diag(sandwich::vcovHC(tbtf_lm, type = "HC1")))

cws_pref_basis_lm <- list(entrepreneurship_lm,
                          innovation_lm,
                          prices_lm,
                          quality_lm,
                          liberties_lm,
                          influence_lm,
                          localties_lm,
                          tbtf_lm)

cws_pref_basis_se <- list(entrepreneurship_se,
                          innovation_se,
                          prices_se,
                          quality_se,
                          liberties_se,
                          influence_se,
                          localties_se,
                          tbtf_se)

cws_pref_basis_labels <- c("Disagree: Entrepreneurship", "Disagree: Innovation", "Disagree: Prices", "Disagree: Quality",
                           "Agree: Infringe lib.", "Agree: pol. influence", "Agree: weaken ties", "Agree: too big to fail",
                           "Party: Independent", "Party: Republican",
                           "Age: 40-59", "Age: 60+",
                           "Gender: Female", "Gender: Other",
                           "Educ: Some college", "Educ: Bachelor's degree", "Educ: Graduate degree",
                           "Race: Black", "Race: Latinx", "Race: Asian", "Race: Multiple / Other", 
                           "Income: 35-75k", "Income: 75-150k", "Income: 150k+", "Income: Missing",
                           "Constant")

stargazer::stargazer(cws_pref_basis_lm,
                     se = cws_pref_basis_se,
                     dep.var.labels = "Support for replacing CWS (binary)",
                     covariate.labels = cws_pref_basis_labels,
                     star.cutoffs = c(0.05, 0.01, 0.001),
                     no.space = TRUE,
                     df = FALSE,
                     header = FALSE,
                     omit.stat = c("f"),
                     font.size = "scriptsize",
                     label = "cws-preference-basis-tab",
                     out = "tables/cws-preference-basis-tab.tex"
                     )
```

The code below generates Table A.8 in the appendix.

```{r attitudinal-basis-tab, include = FALSE}

insider_lm <- lm(consumer_welfare_num ~ insider + party + age + gender + education + race + income, data = public_survey_data, weights = weights) 
insider_se <- sqrt(diag(sandwich::vcovHC(insider_lm, type = "HC1")))

tech_lm <- lm(consumer_welfare_num ~ tech + party + age + gender + education + race + income, data = public_survey_data %>% filter(tech %in% c("No", "Yes")), weights = weights) 
tech_se <- sqrt(diag(sandwich::vcovHC(tech_lm, type = "HC1")))
  
union_lm <- lm(consumer_welfare_num ~ union + party + age + gender + education + race + income, data = public_survey_data, weights = weights) 
union_se <- sqrt(diag(sandwich::vcovHC(union_lm, type = "HC1")))

power_lm <- lm(consumer_welfare_num ~ business_power + party + age + gender + education + race + income, data = public_survey_data, weights = weights) 
power_se <- sqrt(diag(sandwich::vcovHC(power_lm, type = "HC1")))

capture_lm <- lm(consumer_welfare_num ~ government_capture + party + age + gender + education + race + income, data = public_survey_data, weights = weights)
capture_se <- sqrt(diag(sandwich::vcovHC(capture_lm, type = "HC1")))
  
busreg_lm <- lm(consumer_welfare_num ~ business_regulation + party + age + gender + education + race + income, data = public_survey_data, weights = weights) 
busreg_se <- sqrt(diag(sandwich::vcovHC(busreg_lm, type = "HC1")))

att_basis_lm <- list(insider_lm,
                     tech_lm,
                     union_lm,
                     power_lm,
                     capture_lm,
                     busreg_lm)

att_basis_se <- list(insider_se,
                     tech_se,
                     union_se,
                     power_se,
                     capture_se,
                     busreg_se)

att_basis_labels <- c("Personal exposure",
                      "Tech. worker",
                      "Union member",
                      "Business has too much power",
                      "Gov. works for a few big interests",
                      "Business reg. needed to protect public",
                      "Party: Independent", "Party: Republican",
                      "Age: 40-59", "Age: 60+",
                      "Gender: Female", "Gender: Other",
                      "Educ: Some college", "Educ: Bachelor's degree", "Educ: Graduate degree",
                      "Race: Black", "Race: Latinx", "Race: Asian", "Race: Multiple / Other", 
                      "Income: 35-75k", "Income: 75-150k", "Income: 150k+", "Income: Missing",
                      "Constant")

stargazer::stargazer(att_basis_lm,
                     se = att_basis_se,
                     dep.var.labels = "Support for replacing CWS (binary)",
                     covariate.labels = att_basis_labels,
                     star.cutoffs = c(0.05, 0.01, 0.001),
                     no.space = TRUE,
                     df = FALSE,
                     header = FALSE,
                     omit.stat = c("f"),
                     font.size = "scriptsize",
                     label = "attitudinal-basis-tab",
                     out = "tables/attitudinal-basis-tab.tex"
                     )
```

Tables A.9-A.11 in the appendix were manually constructed.

The code below generates Table A.12 in the appendix.

```{r risk-comparison-no-controls-tab, include = FALSE}

hyp_2_lm_entre <- lm(econ_entrepreneurship ~ antitrust_lawyer, data = hypothesis_2_data, weights = weights) 
hyp_2_se_entre <- sqrt(diag(sandwich::vcovHC(hyp_2_lm_entre, type = "HC1")))

hyp_2_lm_innov <-lm(econ_innovation ~ antitrust_lawyer, data = hypothesis_2_data, weights = weights) 
hyp_2_se_innov <- sqrt(diag(sandwich::vcovHC(hyp_2_lm_innov, type = "HC1")))

hyp_2_lm_prices <- lm(econ_lower_prices ~ antitrust_lawyer, data = hypothesis_2_data, weights = weights) 
hyp_2_se_prices <- sqrt(diag(sandwich::vcovHC(hyp_2_lm_prices, type = "HC1")))

hyp_2_lm_quality <-lm(econ_higher_quality ~ antitrust_lawyer, data = hypothesis_2_data, weights = weights) 
hyp_2_se_quality <- sqrt(diag(sandwich::vcovHC(hyp_2_lm_quality, type = "HC1")))

hyp_2_lm_liberty <- lm(social_infringe_lib ~ antitrust_lawyer, data = hypothesis_2_data, weights = weights) 
hyp_2_se_liberty <- sqrt(diag(sandwich::vcovHC(hyp_2_lm_liberty, type = "HC1")))

hyp_2_lm_lobbying <- lm(social_pol_influence ~ antitrust_lawyer, data = hypothesis_2_data, weights = weights) 
hyp_2_se_lobbying <- sqrt(diag(sandwich::vcovHC(hyp_2_lm_lobbying, type = "HC1")))

hyp_2_lm_localties <- lm(social_local_commun ~ antitrust_lawyer, data = hypothesis_2_data, weights = weights) 
hyp_2_se_localties <- sqrt(diag(sandwich::vcovHC(hyp_2_lm_localties, type = "HC1")))

hyp_2_lm_tbtf <- lm(social_tbtf ~ antitrust_lawyer, data = hypothesis_2_data, weights = weights) 
hyp_2_se_tbtf <- sqrt(diag(sandwich::vcovHC(hyp_2_lm_tbtf, type = "HC1")))

hyp_2_lm <- list(hyp_2_lm_entre,
                 hyp_2_lm_innov,
                 hyp_2_lm_prices,
                 hyp_2_lm_quality,
                 hyp_2_lm_liberty,
                 hyp_2_lm_lobbying,
                 hyp_2_lm_localties,
                 hyp_2_lm_tbtf
                 )

hyp_2_se <- list(hyp_2_se_entre,
                 hyp_2_se_innov,
                 hyp_2_se_prices,
                 hyp_2_se_quality,
                 hyp_2_se_liberty,
                 hyp_2_se_lobbying,
                 hyp_2_se_localties,
                 hyp_2_se_tbtf
                 )

hyp_2_labels <- c("Antitrust lawyer",
                     "Constant")

stargazer::stargazer(hyp_2_lm,
                     se = hyp_2_se,
                     dep.var.caption = "",
                     dep.var.labels = c("Entrepren.", "Innovation", "Prices", "Quality", "Infring lib.", "Pol. influence", "Weaken ties", "Too big to fail"),
                     covariate.labels = hyp_2_labels,
                     star.cutoffs = c(0.05, 0.01, 0.001),
                     no.space = TRUE,
                     df = FALSE,
                     header = FALSE,
                     omit.stat = c("f"),
                     font.size = "scriptsize",
                     label = "risk-comparison-no-controls-tab",
                     out = "tables/risk-comparison-no-controls-tab.tex"
                     )
```

\pagebreak

\setstretch{1}

# Regression Output

\begin{landscape}

\input{tables/risk-comparison-tab} 

\pagebreak

\input{tables/policy-cleavage-tab}

\pagebreak

\input{tables/value-basis-tab}

\end{landscape}

\pagebreak

\input{tables/public-conjoint-tab}

\pagebreak

\input{tables/conjoint-diffs-tab}

\pagebreak

\input{tables/candidate-evaluation-tab}

\pagebreak

\input{tables/cws-preference-basis-tab}

\pagebreak

\input{tables/attitudinal-basis-tab}

\pagebreak

\setcounter{table}{11}

\begin{landscape}

\input{tables/risk-comparison-no-controls-tab}

\end{landscape}



